package vn.pdg.zoombie.bean;

import java.util.ArrayList;
import android.app.Activity;
import android.app.Application;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.util.Log;

public class DataApplication extends Application {

	private final String TAG = "DataApplication";
	SharedPreferences pref;
	SharedPreferences.Editor editor;
	private ArrayList<Activity> listActivity;  
	private boolean isHomeActivity;

	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
		pref = getSharedPreferences("blogKey", MODE_PRIVATE);
		listActivity = new ArrayList<Activity>();
	}

	@Override
	public void onLowMemory() {
		// TODO Auto-generated method stub
		Log.i(TAG, "onLowMemory()");

		super.onLowMemory();
	}

	@Override
	public void onConfigurationChanged(Configuration newConfig) {
		// TODO Auto-generated method stub
		super.onConfigurationChanged(newConfig);
	}

	public void addActivity(Activity _activity) {
		listActivity.add(_activity);
	}

	public ArrayList<Activity> getListActivity() {
		return listActivity;
	}
	
	public void removeActivity(int position){
		listActivity.remove(position);
	}

	public void clearlistActivity() {
		for (Activity tempActivity : listActivity)
			tempActivity.finish();
		listActivity.clear();
	}
	public void clearlistActivity(ArrayList<Activity> _listActivity) {
		int tempSize=_listActivity.size();
		for (Activity tempActivity : _listActivity){
			tempActivity.finish();
		}
		_listActivity.clear();
	}

	
	public boolean isHomeActivity() {
		return isHomeActivity;
	}

	public void setHomeActivity(boolean isHomeActivity) {
		this.isHomeActivity = isHomeActivity;
	}

}
